<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('新员工培训计划评估')" />
	<th:block th:include="include :: businessCSS" />
	<style type="text/css">
	.layui-form-selectup dl{bottom:auto}
	.layui-form-checkbox{margin:0}
	</style>
</head>
<body class="no-skin">
<div class="main-container" id="main-container">
	<div class="main-content">
	<form class="layui-form head-form" id="form">
		<input type="hidden" id="guid" name="guid" th:value="${businessData?.guid}">
	    <div class="north">
			<!-- 静态表格 -->
		    <div style="margin:10px">
			  	<table class="layui-table" lay-size="sm">
			    <colgroup>
			      <col width="25%">
			      <col width="25%">
			      <col width="25%">
			      <col width="25%">
			    </colgroup>
				<thead>
			      <tr>
			        <th colspan="8">新员工培训计划评估</th>
			      </tr> 
			    </thead>
			    <tbody>
		    	  <tr>
			        <td class="table-title">培训师姓名</td>
			        <td class="canntEdit" th:text="${businessData?.pUserName}"></td>
			        <td class="table-title">培训内容</td>
			        <td class="canntEdit" th:text="${businessData?.vPxNl}"></td>
			      </tr>
			      <tr>
			        <td class="table-title">培训时间</td>
			        <td class="canntEdit" th:text="${#dates.format(businessData?.dPxSj, 'yyyy-MM-dd HH:mm:ss')}"></td>
			      	<td class="table-title"><font class="f_red">*</font>实际培训时间</td>
			        <td>
			        	<input type="text" id="dSjPxSj" name="dSjPxSj" th:value="${#dates.format(businessData?.dSjPxSj, 'yyyy-MM-dd HH:mm:ss')}" autocomplete="off" readonly class="layui-input" placeholder="请选择时间"/>
			        </td>
			      </tr>
			      <tr>
			        <td class="table-title">培训天数</td>
			        <td class="canntEdit" th:text="${businessData?.fPxTs}"></td>
			        <td class="table-title">培训员工</td>
			        <td class="canntEdit" th:text="${businessData?.cUserName}"></td>
			      </tr>
			      <tr>
			        <td class="table-title">员工公司</td>
			        <td class="canntEdit" th:text="${businessData?.cCidName}"></td>
			        <td class="table-title">员工部门</td>
			        <td class="canntEdit" th:text="${businessData?.cDeptName}"></td>
			      </tr>
			      <tr>
			      	<td class="table-title"><font class="f_red">*</font>培训评估</td>
			        <td colspan="3">
			        	<textarea style="margin:0;height:200px" id="vPxPg" name="vPxPg" th:text="${businessData?.vPxPg}" class="layui-textarea" placeholder="培训评估(不超过一千字)" maxlength="1000"></textarea>
		        	</td>
			      </tr>
		      	</tbody>
			  </table>
		  	</div>
    	</div>
	    <div class="layui-hide">
	        <input type="button" lay-submit="" lay-filter="btn_save" id="btn_save" value="保存">
	    </div>
    </form>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var pageType = [[${pageType}]],
		businessData = [[${businessData}]];
	/*]]>*/
</script>
<script type="text/javascript">
var $,layer,form,laydate,element;//定义layui模块
layui.use(['laydate','form','layer','jquery','util','element'], function () {
 	$ = layui.$,layer = layui.layer,form = layui.form,laydate = layui.laydate,util = layui.util,element=layui.element;
 	laydate.render({elem:'#dSjPxSj',trigger:'click',type:'datetime'});
 	if($('#vPjZt').val()=='待评')$('#fZPf').val(0);//初始页面默认总分赋值100
 	if($('#vPjZt').val()=='已评'){
 		$('table input').attr('readonly','readonly');
		$('table .canntEdit').removeClass('canntEdit');
 	 	$("input[type='checkbox']").attr('disabled','disabled');
 	 	$("input[type='radio']").attr('disabled','disabled');
 	}
 	element.render();
 	form.render();
	form.on('checkbox', function (obj) {
		$("input[type='checkbox'][name="+obj.elem.name+"]").prop("checked", "");
		$(this).prop("checked", "checked");
		form.render('checkbox');
		var sum_score=0;
		$.each($("input[type='checkbox']"),function(i,v){//重新计算总分
			if(v.checked)sum_score+=Number(v.value);
		})
		$('#fZPf').val(sum_score);
	})
	form.on('radio',function(obj){//监听下次期待参加课程，非选择‘其他’时，清空‘其他’输入框
		if(obj.value !='其他')$('#vQdKc2').val('');
	})
})
function btn1(){//保存
	var checkFlag=true,
		rFlag=true;
	$.each($('[type="checkbox"]'),function(i,v){
		if(!$('[type="checkbox"][name='+v.name+']:checked').val())checkFlag=false;
	})
	form.on('submit(btn_save)', function(data){
		$.operate.post('/hr/trainingplanx/bccgpost',{infoItems:JSON.stringify([data.field])},function(res){
			if(res.code!=0){
				$.modal.msgError(res.msg,{icon:2});
				rFlag=false;
			}
		},false);
	});
	if(checkFlag)$('#btn_save').click();
	else $.modal.msgError("评分标准不能放空！");
	return rFlag;
}
function btn2(){//提交
	var checkFlag=true,
		rFlag=true;
	$.each($('[type="checkbox"]'),function(i,v){
		if(!$('[type="checkbox"][name='+v.name+']:checked').val())checkFlag=false;
	})
	form.on('submit(btn_save)', function(data){
		$.operate.post('/hr/trainingplanx/tjpjpost',{infoItems:JSON.stringify([data.field])},function(res){
			if(res.code!=0){
				$.modal.msgError(res.msg,{icon:2});
				rFlag=false;
			}
		},false);
	});
	if(checkFlag)$('#btn_save').click();
	else $.modal.msgError("评分标准不能放空！");
	return rFlag;
}
$('#vQdKc2').focus(function(){//勾选同name最后一个单选框——其他
	$("input[name=vQdKc]").last().click();
 	form.render();
})
</script>
</body>
</html>